<!-- 日志审计-操作日志页面 -->
<template>
  <div style="width: 100%; height: calc(100% - 66px)">
    <CustomTabs :tabList="tabList" :activeName="activeName" @tabSelect="handelTabSelected" style="padding-left: 15px" />
    <uapLog v-if="activeName === 'first'" />
    <ifpLog v-if="activeName === 'second'" />
    <px-logs v-if="activeName === 'third'" :host="hostUrl" :userId="userId" sysType="ifp" sysCode="sys-ifp" :token="token" @get-error="getError" />
  </div>
</template>
<script lang="ts" setup>
import CustomTabs from "@/components/Tabs/index.vue";
import { onMounted, ref } from "vue";
import ifpLog from "./ifpLog.vue";
import uapLog from "./uapLog.vue";

defineOptions({
  name: "SYSTEM_LOG_MANAGE_OPERATE_LOG"
});

const hostUrl = `${import.meta.env.VITE_API_URL}/digitaltwins`;

onMounted(() => {
  const userInfo = JSON.parse(localStorage.getItem("userInfo"));
  userId.value = userInfo.userId;
  const globalInfo = JSON.parse(localStorage.getItem("GlobalState"));
  token.value = globalInfo.token;
});

const tabList = ref([
  { name: "first", label: "系统操作日志" },
  { name: "second", label: "业务操作日志" },
  { name: "third", label: "日志" }
]);

const activeName = ref("first");
const token = ref("");
const userId = ref("");

const handelTabSelected = selectName => {
  activeName.value = selectName;
};

const getError = err => {
  console.log(err);
};
</script>
